<h1>User grading results</h1>

<table class="info">
<tr class="info-head"><th>User</th><th>Name</th>
<% @problems.each do |p| %>
  <th><%= p.name %></th>
<% end %>
<th>Total</th>
<th>Passed</th>
</tr>
<% counter = 0 %>
<% @scorearray.each do |sc| %>
  <tr class="<%= (counter %2 ==0) ? "info-even" : "info-odd" %>">
    <% total = 0 %>
    <% num_passed = 0 %>
    <% sc.each_index do |i| %>
      <% if i<=1 %>
        <td><%= sc[i] %></td>
      <% else %>  
        <td><%= sc[i][0] %></td>
        <% total += sc[i][0] %>
        <% num_passed += 1 if sc[i][1] %>
      <% end %>
    <% end %>
    <td><%= total %></td>
    <td><%= num_passed %></td>
  </tr>
  <% counter += 1 %>
<% end %>
</table>
